#include "circle.h"
//  设定x
void Circle::set_x(int x)
{
	this->x = x;
}
//  设定y
void Circle::set_y(int y) { this->y = y; }
//  设定半径  Set radius
void Circle::set_radius(int r) { this->r = r; }
//  返回周长 perimeter
void Circle::Perimeter(int r) { cout << "圆周长为:" << 2 * PI * r << endl; }
//  返回面积 area
void Circle::area(int r) { cout << "圆的面积为：" << PI * r * r << endl; }
//  返回直径  diameter
void Circle::diameter(int r) { cout << "圆的周长为:" << 2 * r << endl; }
//  返回圆心 Set center
void Circle::set_center(int x, int y) { cout << "圆心为:(" << x << "," << y << ")" << endl; }
//  获得x
int Circle::get_x() { return x; }
//  获得y
int Circle::get_y() { return y; }
//  获得半径  Set radiu
int Circle::get_radius() { return r; }

//  判定两个圆是否相切
void Circle::circle_tangent(Circle other)
{
	/**********************第一个圆的信息*********************************/

	int X1 = get_x();
	int Y1 = get_y();
	int R1 = get_radius();
	/**********************第二个圆的信息*********************************/
	int X2 = other.get_x();
	int Y2 = other.get_y();
	int R2 = other.get_radius();
	// 两个圆心之间的距离
	double D;
	D = sqrt(abs(pow((X1 - X2), 2) - pow((Y1 - Y2), 2)));
	if (D == R1 + R2)
	{
		cout << "两个圆外切" << endl;
	}
	else if (D == abs(R1 - R2))
	{

		cout << "两个圆内切" << endl;
	}
	else if (D > R1 + R2)
	{
		cout << "两个圆外离" << endl;
	}
	else if (D > 0 && D < abs(R1 - R2))
	{
		cout << "两个圆内含" << endl;
	}
	else
	{
		cout << "两个圆相交" << endl;
	}
}
